package datastructures;

import java.util.Arrays;

public class VariableList {

	private int[] variables;
	
	public VariableList(int variable) {
		variables = new int[] {variable};
	}
	
	public int[] getVariables() {
		return variables;
	}
	
	public int medianVariable() {
		return variables[ variables.length/2 ];
	}

	public void addVariable(int variable) {
		int[] new_array = Arrays.copyOf(variables, variables.length + 1);
		new_array[variables.length] = variable;
		Arrays.sort(new_array);
		variables = new_array;
	}
	
}
